const app = getApp()
const util = require('../../../utils/util.js')
const lbbService = require('../../../pages/service/service.js');
const lbbTaskService = require('../service/task-service.js');
const lbbInneralTaskService = require('../service/task-inneral-service.js');


Page({

  /**
   * 页面的初始数据
   */

  data: {
    freshen:true,
    formData:{
        taskId:null,
        tipId:null,
        taskName:null,
        taskExecutor:null,
        taskLeader:null,
        taskProponenter:null,
        taskContent:null,
        executorList:[],
        leaderList:[],
        proponenterList:[],
        feedbackList:[
            {
                title:'有没有进行分析',
                type:'text'
            }
        ]
    },
    maxImgLength:9,
    selected:null,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const vm = this
    vm.data.formData.taskId = options.taskId
    vm.data.formData.tipId = options.tipId
    lbbInneralTaskService.getFeedbackTaskDetail(
        {
            taskId:options.taskId
        },function(res) {
            console.log(res.data)
            vm.setData({
                taskForm:{
                    taskName: res.data.taskName,
                    taskExecutor: res.data.doUserName,
                    taskLeader: res.data.leadUserName,
                    taskProponenter: res.data.introducerName,
                    taskContent: res.data.taskContent
                }
            })
        }
    )
    
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    let that = this;
    that.personalModal = that.selectComponent("#personalModal");
    that.toast = that.selectComponent("#toast");
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {    
    const that = this  
    console.log(that.data.freshen)
    if (that.data.freshen) {
        lbbInneralTaskService.getFeedbackRecordDetail(
            {
                taskId:that.data.formData.taskId,
                tipId:that.data.formData.tipId
            },function(res) {
                console.log('data.Array ========================>',res.data)
                let toUserList = []
                let toUserRemark
                let leaderList = []
                let leaderRemark
                let introducerList = []
                let introducerRemark
                let tabList = []
                let select
                if (res.data['执行人'] && res.data['执行人'].list.length>0) {
                    toUserList = res.data['执行人'].list
                    console.log(toUserList)
                    tabList.push('执行人')
                    toUserRemark = res.data['执行人'].memo
                    for (let i=0;i<toUserList.length;i++) {
                        if (toUserList[i].infoType=='单选') {
                            let radioList = toUserList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<radioList.length;j++) {
                                if (radioList[j]==toUserList[i].feedbackContent) {
                                    list.push({
                                        label:radioList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:radioList[j]
                                    })
                                }
                            }
                            toUserList[i]['radioList'] = list
                        } else if (toUserList[i].infoType=='多选') {
                            let checkboxList = toUserList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<checkboxList.length;j++) {
                                if (toUserList[i].feedbackContent.split(',').includes(checkboxList[j])) {
                                    list.push({
                                        label:checkboxList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:checkboxList[j]
                                    })
                                }
                            }
                            toUserList[i]['checkboxList']=list
                        } 
                    }
                }
                if (res.data['牵头人'] && res.data['牵头人'].list.length>0) {
                    leaderList = res.data['牵头人'].list
                    tabList.push('牵头人')
                    leaderRemark = res.data['牵头人'].memo
                    for (let i=0;i<leaderList.length;i++) {
                        if (leaderList[i].infoType=='单选') {
                            let radioList = leaderList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<radioList.length;j++) {
                                if (radioList[j]==leaderList[i].feedbackContent) {
                                    list.push({
                                        label:radioList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:radioList[j]
                                    })
                                }
                            }
                            leaderList[i]['radioList'] = list
                        } else if (leaderList[i].infoType=='多选') {
                            let checkboxList = leaderList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<checkboxList.length;j++) {
                                if (leaderList[i].feedbackContent.split(',').includes(checkboxList[j])) {
                                    list.push({
                                        label:checkboxList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:checkboxList[j]
                                    })
                                }
                            }
                            leaderList[i]['checkboxList']=list
                        }  
                    }
                }
                if (res.data['提出人'] && res.data['提出人'].list.length>0) {
                    introducerList = res.data['提出人'].list
                    tabList.push('提出人')
                    introducerRemark = res.data['提出人'].memo
                    for (let i=0;i<introducerList.length;i++) {
                        if (introducerList[i].infoType=='单选') {
                            let radioList = introducerList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<radioList.length;j++) {
                                if (radioList[j]==introducerList[i].feedbackContent) {
                                    list.push({
                                        label:radioList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:radioList[j]
                                    })
                                }
                            }
                            introducerList[i]['radioList'] = list
                        } else if (introducerList[i].infoType=='多选') {
                            let checkboxList = introducerList[i].feedbackConfObj
                            let list = []
                            for (let j=0;j<checkboxList.length;j++) {
                                if (introducerList[i].feedbackContent.split(',').includes(checkboxList[j])) {
                                    list.push({
                                        label:checkboxList[j],
                                        checked: true
                                    })
                                } else {
                                    list.push({
                                        label:checkboxList[j]
                                    })
                                }
                            }
                            introducerList[i]['checkboxList']=list
                        } 
                    }
                }
                if (tabList.includes('执行人')) {
                    select = '执行人'
                } else if (!tabList.includes('执行人') && tabList.includes('牵头人')) {
                    select = '牵头人'
                } else if (!tabList.includes('执行人') && !tabList.includes('牵头人') && tabList.includes('提出人')) {
                    select = '提出人'
                }
                that.setData({
                    tabList: tabList,
                    toUserList: toUserList,
                    leaderList: leaderList,
                    introducerList: introducerList,
                    select: select,
                    toUserRemark:toUserRemark,
                    leaderRemark:leaderRemark,
                    introducerRemark:introducerRemark
                })
                that.data.freshen = false
            }
        )
    }
    
  },

  /**
   * 图片组件
   */
  setImgArr: function (e) {
    let that = this;
    that.data.freshen = false
    let imgArray = e.detail;

    console.log(imgArray)
    console.log(e)
    let newUpLoadImg = []
    let oldUpLoadImg = []
    imgArray.forEach(item =>{
        if(item.indexOf('https://man.ejiakanghu.com.cn/images/routing_imgs')==-1) {
            newUpLoadImg.push(item)
        } else {
            oldUpLoadImg.push(item)
        }
    })
    if (!imgArray && e.target.dataset.ismust==1) {
        that.toast.showToast(e.target.dataset.title+'不能为空');
        return
     } else if (e.target.dataset.ismust!=1 || ( e.target.dataset.ismust==1 && imgArray.length>0)) {
         if (that.data.select=='执行人') {
             that.data.toUserList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                    if(newUpLoadImg.length>0) {
                        wx.showLoading({
                            title: '正在上传图片',
                            mask: true
                          })
                        util.newUpLoadImg(app.globalData.header, newUpLoadImg, 0, [], function(imgIdArray) {
                            item.feedbackContentImage = oldUpLoadImg.concat(imgIdArray) 
                            console.log('item================>',item)
                            wx.hideLoading()
                            that.toast.showToast('添加成功', 'success');
                        });
                    } else {
                        item.feedbackContentImage = oldUpLoadImg
                        console.log('item================>',item)
                    }
                 }
             })
    
         } else if (that.data.select=='牵头人') {
             that.data.leaderList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    if(newUpLoadImg.length>0) {
                        wx.showLoading({
                            title: '正在上传图片',
                            mask: true
                          })
                        util.newUpLoadImg(app.globalData.header, newUpLoadImg, 0, [], function(imgIdArray) {
                            item.feedbackContentImage = oldUpLoadImg.concat(imgIdArray) 
                            console.log('item================>',item)
                            wx.hideLoading()
                            that.toast.showToast('添加成功', 'success');
                        });
                    } else {
                        item.feedbackContentImage = oldUpLoadImg
                        console.log('item================>',item)
                    }
                 }
             })
         } else if (that.data.select=='提出人') {
             that.data.introducerList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    if(newUpLoadImg.length>0) {
                        wx.showLoading({
                            title: '正在上传图片',
                            mask: true
                          })
                        util.newUpLoadImg(app.globalData.header, newUpLoadImg, 0, [], function(imgIdArray) {
                            item.feedbackContentImage = oldUpLoadImg.concat(imgIdArray) 
                            console.log('item================>',item)
                            wx.hideLoading()
                            that.toast.showToast('添加成功', 'success');
                        });
                    } else {
                        item.feedbackContentImage = oldUpLoadImg
                        console.log('item================>',item)
                    }
                 }
             })
         }
         console.log(that.data)
     }
  },
  

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  },

  onChange(e) {
    let that = this
    const data = e.detail
    console.log('=================>',data)
  },

  selected: function (e) {
    let that = this
    console.log(e)
    let index = e.currentTarget.dataset.index
    //console.log("index",index)
    if (index == '执行人') {
      that.setData({
        select:'执行人' 
      })
      console.log(that.data)
    } else if (index == '牵头人') {
      that.setData({
        select: '牵头人' 
      })
      console.log(that.data)
    } else {
      that.setData({
        select: '提出人'
      })
      console.log(that.data)
    } 
  },

  inputText(e) {
    if (!e.detail.value && e.target.dataset.ismust==1) {
       this.toast.showToast(e.target.dataset.title+'不能为空');
       return
    } else if (e.detail.value.length>200) {
        this.toast.showToast(e.target.dataset.title+'不能大于20个字');
        return
     }  else {
        if (this.data.select=='执行人') {
            this.data.toUserList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    item.feedbackContent = e.detail.value
                }
            })
            this.setData({
                toUserList:this.data.toUserList
            })
        } else if (this.data.select=='牵头人') {
            this.data.leaderList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    item.feedbackContent = e.detail.value
                }
            })
            this.setData({
                leaderList:this.data.leaderList
            })
        } else if (this.data.select=='提出人') {
            this.data.introducerList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    item.feedbackContent = e.detail.value
                }
            })
            this.setData({
                introducerList:this.data.introducerList
            })
        }
        console.log(this.data)
    }
  },

  inputBoxCode(e) {
    console.log(e)
    console.log(this.data)
    if (!e.detail.value && e.target.dataset.ismust==1) {
       this.toast.showToast(e.target.dataset.title+'不能为空');
       return
    } else if (e.detail.value.length>200) {
       this.toast.showToast(e.target.dataset.title+'不能大于20个字');
       return
    } else {
        if (this.data.select=='执行人') {
            this.data.toUserList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    if (e.target.dataset.infotype=='文本'){
                        item.feedbackContent = e.detail.value
                    } else if (e.target.dataset.infotype=='图文') {
                        item.feedbackContentText = e.detail.value
                        item.feedbackContent = e.detail.value
                        // let data = {
                        //     text:e.detail.value,
                        //     image:[]
                        // }
                        // if (!item.feedbackContent) {
                        //     item.feedbackContent = JSON.stringify(data)
                        // } else {
                        //     let oldData = JSON.parse(item.feedbackContent)
                        //     if (oldData.image.length>0) {
                        //         data.image = oldData.image
                        //     }
                        //     item.feedbackContent = JSON.stringify(data)
                        // }
                    }
                    
                }
            })
            this.setData({
                toUserList:this.data.toUserList
            })
        } else if (this.data.select=='牵头人') {
            this.data.leaderList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    if (e.target.dataset.infotype=='文本'){
                        item.feedbackContent = e.detail.value
                    } else if (e.target.dataset.infotype=='图文') {
                        item.feedbackContentText = e.detail.value
                        item.feedbackContent = e.detail.value
                    }
                }
            })
            this.setData({
                leaderList:this.data.leaderList
            })
        } else if (this.data.select=='提出人') {
            this.data.introducerList.forEach(item =>{
                if (item.id==e.target.dataset.id) {
                    if (e.target.dataset.infotype=='文本'){
                        item.feedbackContent = e.detail.value
                    } else if (e.target.dataset.infotype=='图文') {
                        item.feedbackContentText = e.detail.value
                        item.feedbackContent = e.detail.value
                    }
                }
            })
            this.setData({
                introducerList:this.data.introducerList
            })
        }
        console.log(this.data)
    }
    
  },

  /**
   * 输入备注
   */
  inputDesc: function(e){
    let desc = e.detail.value;
    let type = e.target.dataset.type
    util.print('inputDesc',e);
    if(desc.length==100){
      this.toast.showToast('反馈内容不超过100字');
    } else if (desc.length<100) {
        if (type=='执行人') {
            this.setData({
                toUserRemark:desc
            })
        } else if (type=='牵头人') {
            this.setData({
                leaderRemark:desc
            })
        } else if (type=='提出人') {
            this.setData({
                introducerRemark:desc
            })
        }
    }
  },

  /**
   * 输入备注
   */
  radioChange(e) {
    console.log(e)
    if (!e.detail.value && e.target.dataset.ismust==1) {
        this.toast.showToast(e.target.dataset.title+'不能为空');
        return
     } else {
         if (this.data.select=='执行人') {
             this.data.toUserList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                     item.feedbackContent = e.detail.value.toString()
                 }
             })
             this.setData({
                toUserList:this.data.toUserList
            })
         } else if (this.data.select=='牵头人') {
             this.data.leaderList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                     item.feedbackContent = e.detail.value.toString()
                 }
             })
             this.setData({
                leaderList:this.data.leaderList
            })
         } else if (this.data.select=='提出人') {
             this.data.introducerList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                     item.feedbackContent = e.detail.value.toString()
                 }
             })
             this.setData({
                introducerList:this.data.introducerList
            })
         }
         console.log(this.data)
     }
  },

  /**
   * 输入备注
   */
  checkboxChange(e) {
    console.log(e)
    if (!e.detail.value && e.target.dataset.ismust==1) {
        this.toast.showToast(e.target.dataset.title+'不能为空');
        return
     } else {
         if (this.data.select=='执行人') {
             this.data.toUserList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                     item.feedbackContent = e.detail.value.toString()
                     console.log(item.checkboxList)
                     if (item.checkboxList) {
                        item.checkboxList.forEach((inf,i) =>{
                            if(e.detail.value.includes(inf.label)) {
                                let  pushData ={
                                    label:inf.label,
                                    checked:true
                                }
                                item.checkboxList[i] = pushData
                            } else {
                                let  pushData ={
                                    label:inf.label,
                                }
                                item.checkboxList[i] = pushData
                            }
                        })
                     }
                     
                 }
             })
             this.setData({
                toUserList:this.data.toUserList
            })
         } else if (this.data.select=='牵头人') {
             this.data.leaderList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                     item.feedbackContent = e.detail.value.toString()
                     if (item.checkboxList) {
                        item.checkboxList.forEach((inf,i) =>{
                            if(e.detail.value.includes(inf.label)) {
                                let  pushData ={
                                    label:inf.label,
                                    checked:true
                                }
                                item.checkboxList[i] = pushData
                            } else {
                                let  pushData ={
                                    label:inf.label,
                                }
                                item.checkboxList[i] = pushData
                            }
                        })
                     }
                 }
             })
             this.setData({
                leaderList:this.data.leaderList
            })
         } else if (this.data.select=='提出人') {
             this.data.introducerList.forEach(item =>{
                 if (item.id==e.target.dataset.id) {
                    if (item.checkboxList) {
                        item.checkboxList.forEach((inf,i) =>{
                            if(e.detail.value.includes(inf.label)) {
                                let  pushData ={
                                    label:inf.label,
                                    checked:true
                                }
                                item.checkboxList[i] = pushData
                            } else {
                                let  pushData ={
                                    label:inf.label,
                                }
                                item.checkboxList[i] = pushData
                            }
                        })
                     }
                 }
             })
             this.setData({
                introducerList:this.data.introducerList
            })
         }
         console.log(this.data)
     }
  },

  onSubmit() {
    const vm = this
    const tabList = vm.data.tabList
    const dataList = []
    let toUserObj ={
        tipId:vm.data.formData.tipId,
        role:'执行人',
        feedbackList:[],
        memo:vm.data.toUserRemark
    }
    let leaderObj ={
        tipId:vm.data.formData.tipId,
        role:'牵头人',
        feedbackList:[],
        memo:vm.data.leaderRemark
    }
    let introducerObj ={
        tipId:vm.data.formData.tipId,
        role:'提出人',
        feedbackList:[],
        memo:vm.data.introducerRemark
    }
    if (tabList.includes('执行人')) {
        const feedbackList = []
        for(let i=0;i<vm.data.toUserList.length;i++) {
            if (vm.data.toUserList[i].infoType!='图文') {
                if (!vm.data.toUserList[i].feedbackContent && vm.data.toUserList[i].isMust==1) {
                    vm.toast.showToast('执行人'+vm.data.toUserList[i].title +'的反馈内容不能为空');
                    return
                } else if (vm.data.toUserList[i].feedbackContent) {
                    feedbackList.push({
                        content:vm.data.toUserList[i].feedbackContent,
                        feedbackConfId:vm.data.toUserList[i].id
                    })
                }
            } else if( vm.data.toUserList[i].infoType=='图文') {
                if (!vm.data.toUserList[i].feedbackContentText && vm.data.toUserList[i].isMust==1) {
                    vm.toast.showToast('执行人'+vm.data.toUserList[i].title +'的反馈文本内容不能为空');
                    return
                } else if (vm.data.toUserList[i].feedbackContentText && (!vm.data.toUserList[i].feedbackContentImage || vm.data.toUserList[i].feedbackContentImage== 0) && vm.data.toUserList[i].isMust==1) {
                    vm.toast.showToast('执行人'+vm.data.toUserList[i].title +'的反馈图片至少为一张');
                    return
                    
                } else if (vm.data.toUserList[i].isMust!=1 || (vm.data.toUserList[i].isMust==1 && vm.data.toUserList[i].feedbackContentText && vm.data.toUserList[i].feedbackContentImage && vm.data.toUserList[i].feedbackContentImage.length>0)) {
                    let objData = {
                        text: vm.data.toUserList[i].feedbackContentText,
                        image:vm.data.toUserList[i].feedbackContentImage
                    }
                    feedbackList.push({
                        content:JSON.stringify(objData),
                        feedbackConfId:vm.data.toUserList[i].id
                    })
                    
                      
                }
            }
            
        }
        toUserObj.feedbackList = feedbackList
        dataList.push(toUserObj)
    }
    if (tabList.includes('牵头人')) {
        const feedbackList = []
        for(let i=0;i<vm.data.leaderList.length;i++) {
            if (vm.data.leaderList[i].infoType!='图文') {
                if (!vm.data.leaderList[i].feedbackContent && vm.data.leaderList[i].isMust==1) {
                    vm.toast.showToast('牵头人'+vm.data.leaderList[i].title +'的反馈内容不能为空');
                    return 
                } else if (vm.data.leaderList[i].feedbackContent) {
                    feedbackList.push({
                        content:vm.data.leaderList[i].feedbackContent,
                        feedbackConfId:vm.data.leaderList[i].id
                    })
                }
            }  else if( vm.data.leaderList[i].infoType=='图文') {
                console.log(11111,'--------------------------->',vm.data.leaderList[i])
                if (!vm.data.leaderList[i].feedbackContentText && vm.data.leaderList[i].isMust==1) {
                    vm.toast.showToast('牵头人'+vm.data.leaderList[i].title +'的反馈文本内容不能为空');
                    return
                } else if (vm.data.leaderList[i].feedbackContentText && (!vm.data.leaderList[i].feedbackContentImage || vm.data.leaderList[i].feedbackContentImage== 0) && vm.data.leaderList[i].isMust==1) {
                    vm.toast.showToast('牵头人'+vm.data.leaderList[i].title +'的反馈图片至少为一张');
                    return
                    
                } else if (vm.data.leaderList[i].isMust!=1 ||( vm.data.leaderList[i].isMust==1 && vm.data.leaderList[i].feedbackContentText && vm.data.leaderList[i].feedbackContentImage && vm.data.leaderList[i].feedbackContentImage.length>0 )) {
                    let objData = {
                        text: vm.data.leaderList[i].feedbackContentText,
                        image:vm.data.leaderList[i].feedbackContentImage
                    }
                    feedbackList.push({
                        content:JSON.stringify(objData),
                        feedbackConfId:vm.data.leaderList[i].id
                    })
                }
            }
            
        }
        leaderObj.feedbackList = feedbackList
        dataList.push(leaderObj)
    }
    if (tabList.includes('提出人')) {
        const feedbackList = []
        for(let i=0;i<vm.data.introducerList.length;i++) {
            if (vm.data.introducerList[i].infotype!='图文') {
                if (!vm.data.introducerList[i].feedbackContent && vm.data.introducerList[i].isMust==1) {
                    vm.toast.showToast('提出人'+vm.data.introducerList[i].title +'的反馈内容不能为空')
                    return
                } else if (vm.data.introducerList[i].feedbackContent) {
                    feedbackList.push({
                        content:vm.data.introducerList[i].feedbackContent,
                        feedbackConfId:vm.data.introducerList[i].id
                    })
                }
            }  else if( vm.data.introducerList[i].infoType=='图文') {
                if (!vm.data.introducerList[i].feedbackContentText && vm.data.introducerList[i].isMust==1) {
                    vm.toast.showToast('提出人'+vm.data.introducerList[i].title +'的反馈文本内容不能为空');
                    return
                } else if (vm.data.introducerList[i].feedbackContentText && (!vm.data.introducerList[i].feedbackContentImage || vm.data.introducerList[i].feedbackContentImage== 0) && vm.data.introducerList[i].isMust==1) {
                    vm.toast.showToast('提出人'+vm.data.introducerList[i].title +'的反馈图片至少为一张');
                    return
                    
                } else if ( vm.data.introducerList[i].isMust!=1 ||(vm.data.introducerList[i].isMust==1 && vm.data.introducerList[i].feedbackContentText && vm.data.introducerList[i].feedbackContentImage && vm.data.introducerList[i].feedbackContentImage.length>0)) {
                    let objData = {
                        text: vm.data.introducerList[i].feedbackContentText,
                        image:vm.data.introducerList[i].feedbackContentImage
                    }
                    feedbackList.push({
                        content:JSON.stringify(objData),
                        feedbackConfId:vm.data.introducerList[i].id
                    })
                }
            }
            
        }
        introducerObj.feedbackList = feedbackList
        dataList.push(introducerObj)
    }
    // if(toUserObj.feedbackList.length>0) {
    //     lbbInneralTaskService.saveFeedbackInfo(toUserObj,function(res){
    //         console.log(res)
    //         vm.navToBack()
    //     })
    // }
    // if(leaderObj.feedbackList.length>0) {
    //     lbbInneralTaskService.saveFeedbackInfo(leaderObj,function(res){
    //         console.log(res)
    //         vm.navToBack()
    //     })
    // }
    // if(introducerObj.feedbackList.length>0) {
    //     lbbInneralTaskService.saveFeedbackInfo(introducerObj,function(res){
    //         console.log(res)
    //         vm.navToBack()
    //     })
    // }
    lbbInneralTaskService.saveFeedbackInfoBatch({list:dataList},function(res){
        console.log(res)
        vm.navToBack()
    })
    // if(toUserObj.feedbackList.length>0 && leaderObj.feedbackList.length>0 && introducerObj.feedbackList.length>0) {
        
        
    // }
    
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  // onReachBottom: function () {

  // },

  navToBack(){
	// 获取页面
    var pages = getCurrentPages();
    var beforePage = pages[pages.length - 2];
    // 页面数据操作
    // 调用页面函数
    console.log('beforePage===========>',beforePage)
    beforePage.onShow();
    // 返回
    setTimeout(function () {
        wx.navigateBack({
          delta: 1
        })
      }, 2000)
    // wx.navigateBack({ delta: 1, })
},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

})